<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" xml:lang="th" lang="th">
<head>
	<meta charset="utf-8">
    <title><?php echo $seo_title;?></title>
    <meta name="title" content="<?php echo htmlspecialchars($seo_title, ENT_COMPAT, 'UTF-8');?>" />
    <meta name="keywords"  content="<?php echo htmlspecialchars($seo_keyword, ENT_COMPAT, 'UTF-8');?>" />
    <meta name="description" content="<?php echo addslashes($seo_description);?>" />
    <meta property="fb:app_id" content="<?php echo $fb_api;?>" />
    <meta property="og:type" content="<?php echo $fb_type;?>" />
	<meta name="googlebot" content="noindex,nofollow"/>
	<meta name="robots" content="noindex, nofollow"/>
	<meta name="author" content="You2Play.com"/>
	<meta http-equiv="Cache-Control" content="no-store">
	<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="Expires" content="-1">
	<link rel="icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<link rel="shortcut icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<script type="text/javascript">
	 	/*Set Initail*/
		//document.domain = 'you2play.com';
		var web_path = '<?php echo base_url();?>';
		var protocol = (window.location.protocol == "https:" ? "https":"http");
		if(protocol == "https") window.location.href = window.location.href.replace(protocol,'http');
	</script>
	<?php if(!empty($ga_id)):?>
		<script type="text/javascript">
		  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
		  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
		  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
		  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

		  ga('create', 'UA-16730596-<?php echo $ga_id;?>', 'you2play.com');
		  ga('send', 'pageview');

		</script>		
		<?php if($ga_id != 1):?>
			<script type="text/javascript">
				ga('create', 'UA-16730596-1', 'you2play.com', {'name':'secondTracker'});
			  	ga('secondTracker.send', 'pageview');
			</script>						
		<?php endif;?>	
		<?php if(!empty($ga_event)):?>
			<script type="text/javascript">
				ga('send', 'event', ''+window.location.hostname+'', 'view', '<?php echo $ga_event;?>');
			</script>
			<?php if($ga_id != 1):?>
				<script type="text/javascript">
					ga('secondTracker.send', 'event', ''+window.location.hostname+'', 'view', '<?php echo $ga_event;?>');
				</script>			
			<?php endif;?>
		<?php endif;?>			
	<?php endif;?>
    <!--Load Js-->
    <?php 
    if(!empty($js)):
  		foreach(array_unique($js) as $value):
   			if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
   				echo js_asset($value."?v=2.4")."\n";				
     		endif;
		endforeach;
    endif;
    ?>
    <!--Load Css-->
    <?php 
    if(!empty($css)):
		foreach(array_unique($css) as $value):
			if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/css/'.$value)) && !empty($value)):
				echo css_asset($value."?v=2.4",'', array('media'=>'all'))."\n";			
			endif;
		endforeach;
    endif;
    ?>
	<style type="text/css">
		body,#play_object{
			position: relative;
			width: 640px;
			height: 328px;
		}
		#you2play_logo_embed{
			position: absolute;
			top: 0;
			right:0;
		}
	</style>
</head>
<body>
	<div id="play_object">
		<?php if(!empty($dataResult->song_embed)):?>
			<?php echo $dataResult->song_embed;?>
		<?php else:?>
			<!--Vdo Player-->
			<div id="vdoPlayer">
				<?php if($this->agent->is_mobile()):?>
					<video id='my_video' controls preload='none' <?php echo ($this->input->get('autoplay') ? 'autoplay="autoplay"':'');?></video>
				<?php endif;?>
			</div>
		<?php endif;?>
	</div>
	<a href="<?php echo base_url();?>" id="you2play_logo_embed" target="_blank">
		<?php echo image_asset('../uploads/watermark/watermark_embed.png','',array('width'=>48,'height' => 46));?>
	</a>
<?php if(empty($dataResult->song_embed)): //if no embed load jwplayer?>
<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		var is_mobile = '<?php echo $this->agent->is_mobile();?>';
		var media_type = '<?php echo $dataResult->media_type;?>';
		var file_url = '<?php echo $dataResult->file_url;?>';
		var image_url = '<?php echo @$dataResult->image_url;?>';
		if(is_mobile){
			if(media_type == 'music'){
				//Set Video Source
				$('#my_video').append("<source id='mp3' src='"+file_url+"' type='audio/mp3'>");
				$('#my_video').attr('src',""+file_url+"");
				$('#my_video').attr('width',640);
				$('#my_video').attr('height',382);			
			} else {
				//Set Video Source
				$('#my_video').append("<source id='mp4' src='"+file_url+"' type='video/mp4'>");
				$('#my_video').attr('src',""+file_url+"");
				$('#my_video').attr('width',640);
				$('#my_video').attr('height',382);				
			}
		} else {
			var playlist = [{file:""+file_url+"",image: ""+image_url+""}];	
			jwplayer("vdoPlayer").setup({
				"autostart": false,
			      "flashplayer": "<?php echo js_asset_url('media/player.swf');?>",
				"playlist": playlist,
			      "width": 640,
			      "height": 382
			});	
		}
	
		//Countdown to keep stats 10 seconds
		setTimeout(function(){
			$.ajax({
				type:'post',
				url: web_path+'ajax_view_embed',
				data:({
					id:'<?php echo $dataResult->media_id;?>',
					media_type:'<?php echo $dataResult->media_type;?>'
				})
			});
			/*Hide Logo*/
			//$('#you2play_logo_embed').fadeOut();
		},10000);		
	});	
})(jQuery);
</script>
<?php endif;?>
</body>
</html>